package way.scripts;

import way.scripts.classDoc.model.LevelEnum;
import way.scripts.classDoc.model.Table;
import way.scripts.classDoc.segment.CDModule;
import way.scripts.classDoc.segment.ClassDocument;
import way.scripts.classDoc.segment.ModuleDes;
import way.scripts.util.XWPFDocumentBuilder;

import java.util.Arrays;

public class WriteDoc {
    public static void main(String[] args) {
        ClassDocument classDocument = new ClassDocument();
        classDocument.addModule(new CDModule(){{
            setName("本体管理");
            setModuleDes(new ModuleDes(){{
            }});
        }});

        try {
            new WriteDoc().testWrite(classDocument);
        }catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void testWrite(ClassDocument classDocument) throws Exception {
        String templatePath = "E:\\360MoveData\\Users\\haozhiqiang\\Desktop\\知识图谱构建工具详细设计文档.docx";
        String outPath = "E:\\360MoveData\\Users\\haozhiqiang\\Desktop\\out.docx";
        XWPFDocumentBuilder documentBuilder = new XWPFDocumentBuilder(templatePath, outPath);

        classDocument.getModules();


        documentBuilder.addTitle("1、系统分析", LevelEnum.HEADING_1);
        documentBuilder.addTitle("1.1 本体管理", LevelEnum.HEADING_2);

        Table table = new Table("1", "2", "3");
        table.addRow(Arrays.asList("1-1", "1-2", "1-3"));
        table.addRow(Arrays.asList("2-1", "2-2", "2-3"));
        documentBuilder.addTable(table);

        documentBuilder.close();
    }
}
